/**
 *
 */
package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.DriverChoseLevelCarMapper;
import com.ybkj.daijia.server.model.DriverChoseLevelCar;
import com.ybkj.daijia.server.service.DriverChoseLevelCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Shine
 *
 */
@Service
public class DefaultDriverChoseLevelCarService implements DriverChoseLevelCarService {

    @Autowired
    private DriverChoseLevelCarMapper driverChoseLevelCarMapper;

    @Transactional(rollbackFor = Exception.class)
    public DriverChoseLevelCar insertRecord(DriverChoseLevelCar driverChoseLevelCar) {

        driverChoseLevelCarMapper.insertRecord(driverChoseLevelCar);

        return driverChoseLevelCar;

    }

    @Transactional(rollbackFor = Exception.class)
    public DriverChoseLevelCar updateByPrimaryKey(DriverChoseLevelCar driverChoseLevelCar) {

        driverChoseLevelCarMapper.updateByPrimaryKey(driverChoseLevelCar);

        return driverChoseLevelCar;
    }

    @Override
    public DriverChoseLevelCar findByDriverAndLevelAndCompany(Long driverId, Long driverLevelId,
        Long companyId) {

        return driverChoseLevelCarMapper.selectByPrimaryKey(driverId, driverLevelId, companyId);
    }

    @Override
    public DriverChoseLevelCar findByDriverAndCompany(Long driverId, Long companyId) {

        return driverChoseLevelCarMapper.selectByDriverAndCompany(driverId, companyId);
    }

    @Transactional(rollbackFor = Exception.class)
    public void delete(Long driverId, Long driverLevelId) {
        driverChoseLevelCarMapper.deleteByDriverAndDriverLevel(driverId, driverLevelId);
    }


    @Transactional(rollbackFor = Exception.class)
    public void deleteByDriver(Long driverId) {

        driverChoseLevelCarMapper.deleteByDriver(driverId);

    }


    @Transactional(rollbackFor = Exception.class)
    public void deleteByDriverLevel(Long driverLevelId) {

        driverChoseLevelCarMapper.deleteByDriverLevel(driverLevelId);

    }

    @Override
    public DriverChoseLevelCar findOne(Long id) {

        return null;
    }


}